/**
 * 毫米转ox
 *
 * @param {number} mm
 * @return {*}
 */
export function transformMMToPX(mm: number) {
  let dpi = 0;

  const tmpNode = document.createElement('DIV')!;
  tmpNode.style.cssText =
    'width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden';
  document.body.appendChild(tmpNode);
  dpi = tmpNode.offsetWidth ?? 0;

  tmpNode.parentNode?.removeChild(tmpNode);

  return (dpi * mm) / 25.4;
}
